package com.qdlc.p2p.biz.log.score.lottery;

import com.qdlc.p2p.biz.log.score.BaseScoreLog;
import com.qdlc.p2p.common.constant.ScoreTemplateConstant;
import com.qdlc.p2p.common.exception.ScoreException;

/**
 * 积分抽奖获奖
 */
@SuppressWarnings("serial")
public class ScoreLotteryWinningLog extends BaseScoreLog {

	private String logTemplateNid = ScoreTemplateConstant.SCORE_LOTTERY_WINNING;
	
	public ScoreLotteryWinningLog () {}

	public ScoreLotteryWinningLog (long userId, int score) {
		super(userId, score, ScoreTemplateConstant.SCORE_LOTTERY_WINNING);
		this.setLogTemplateNid(logTemplateNid);
	}

	@Override
	public void modifyScore() {
		Boolean result = scoreDao.updateScore(this.getUser().getUserId(), getScore(), getScore(), 0, 0);
		if(!result){
			throw new ScoreException("更新用户积分失败！", 1);
		}
	}
	
}
